<?php
	/**
	 * Class that represents the http context object
	 * 
	 * @version 1.0
	 * @package Classes
	 */
	class HTTPContext
	{
		
		/**
		 * Initialize HTTPContext class with main variales
		 */
		public static function Initialize()
		{
			if (isset($_SERVER['HTTP_REFERER']))
			{
				self::$url_referrer = $_SERVER['HTTP_REFERER'];	//HTTP_X_FORWARDED_FOR
			}
			self::$get = $_GET;
			self::$session = $_SESSION;
			self::$post = $_POST;
			self::$redirect_status = $_SERVER['REDIRECT_STATUS'];
			self::$request_method = $_SERVER['REQUEST_METHOD'];			
		}
		
		/**
		 * Encapsulates get request
		 */
		public static $get = null;
		
		/**
		 * Encapsulates post request
		 */
		public static $post = null;
		
		/**
		 * Encapsulates server session variable
		 */
		public static $session = null;
		
		/**
		 * Determine the url from wich client is comming
		 */
		public static $url_referrer = null;
		
		/**
		 * Contains parsed controller, action and parameters
		 */
		public static $parsed_url = array();
		
		/**
		 * Determine the url that is solicited
		 */
		public static $url_current = null;
		
		/**
		 * Page redirect status
		 */
		public static $redirect_status = null;
		
		/**
		 * Determine the request method
		*/
		public static $request_method = null;		
		
		//Public functions
		
		/**
		 * Gets a value indicating whether the page is being loaded in response to a client postback, or it was loaded for the first time.
		 */
		public static function IsPostBack()
		{
			return !empty($_POST);
		}
		
	}
?>